<!DOCTYPE html><html><head><title>Ext.draw.Color | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
<style type="text/css">.head-band { display: none; }
.header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
.doc-tab .members .member a.more { background-color: #efefef; }
</style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
</head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
<a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">

    req = {
        liveURL: '.',
        standAloneMode: true,
        origDocClass: 'Ext.draw.Color',
        docClass: 'Ext.draw.Color',
        docReq: 'Ext.draw.Color',
        version: '4.0',
        baseURL: '.',
        baseDocURL: '.',
        baseProdURL: '.'
    };

    clsInfo = {};



</script>

<script type="text/javascript" src="../search.js"></script>
<!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
<script type="text/javascript" src="../class_tree.js"></script>
<script type="text/javascript" src="../class_doc.js"></script>
<script type="text/javascript">
    req.source = 'Color2.html#Ext-draw.Color';
    clsInfo = {"methods":["Color","fromHSL","fromString","getBlue","getDarker","getGrayscale","getGreen","getHSL","getLighter","getRGB","getRed","toHex","toString"],"cfgs":["lightnessFactor"],"properties":[],"events":[],"subclasses":[]};
    Ext.onReady(function() {
        Ext.create('Docs.classPanel');
    });
</script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/Color2.html#Ext-draw.Color" target="_blank">Ext.draw.Color</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><p>Represents an RGB color and provides helper functions get
color components in HSL color space.</p>
<div class="members"><div class="m-cfgs"><div class="definedBy">Defined By</div><a name="configs"></a><h3 class="cfg p">Config Options</h3><h4 class="cfgGroup">Other Configs</h4><div id="config-lightnessFactor" class="member f ni"><a href="Ext.draw.Color.html#config-lightnessFactor" rel="config-lightnessFactor" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.draw.Color.html" class="definedIn docClass">Ext.draw.Color</a><br/><a href="../source/Color2.html#Ext-draw.Color-cfg-lightnessFactor" class="viewSource">view source</a></div><a name="lightnessFactor"></a><a name="config-lightnessFactor"></a><a href="Ext.draw.Color.html#" rel="config-lightnessFactor" class="cls expand">lightnessFactor</a><span> : Number</span></div><div class="description"><div class="short"><p>The default factor to compute the lighter or darker color. Defaults to 0.2.</p>
</div><div class="long"><p>The default factor to compute the lighter or darker color. Defaults to 0.2.</p>
</div></div></div></div><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-Color" class="member f ni"><a href="Ext.draw.Color.html#method-Color" rel="method-Color" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.draw.Color.html" class="definedIn docClass">Ext.draw.Color</a><br/><a href="../source/Color2.html#Ext-draw.Color-method-constructor" class="viewSource">view source</a></div><a name="Color"></a><a name="method-Color"></a><a href="Ext.draw.Color.html#" rel="method-Color" class="cls expand">Color</a>(
<span class="pre">Number red, Number green, Number blue</span>)
 : void</div><div class="description"><div class="short"><p>&nbsp;</p></div><div class="long">
<h3 class="pa">Parameters</h3><ul><li><span class="pre">red</span> : Number<div class="sub-desc"><p>Red component (0..255)</p>
</div></li><li><span class="pre">green</span> : Number<div class="sub-desc"><p>Green component (0..255)</p>
</div></li><li><span class="pre">blue</span> : Number<div class="sub-desc"><p>Blue component (0..255)</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-fromHSL" class="member ni"><a href="Ext.draw.Color.html#method-fromHSL" rel="method-fromHSL" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.draw.Color.html" class="definedIn docClass">Ext.draw.Color</a><br/><a href="../source/Color2.html#Ext-draw.Color-method-fromHSL" class="viewSource">view source</a></div><a name="fromHSL"></a><a name="method-fromHSL"></a><a href="Ext.draw.Color.html#" rel="method-fromHSL" class="cls expand">fromHSL</a>(
<span class="pre">Number h, Number s, Number l</span>)
 : void</div><div class="description"><div class="short"><p>Create a new color based on the specified HSL values.</p>
</div><div class="long"><p>Create a new color based on the specified HSL values.</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">h</span> : Number<div class="sub-desc"><p>Hue component (0..359)</p>
</div></li><li><span class="pre">s</span> : Number<div class="sub-desc"><p>Saturation component (0..1)</p>
</div></li><li><span class="pre">l</span> : Number<div class="sub-desc"><p>Lightness component (0..1)</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;<p>Ext.draw.Color</p>
</li></ul></div></div></div><div id="method-fromString" class="member ni"><a href="Ext.draw.Color.html#method-fromString" rel="method-fromString" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.draw.Color.html" class="definedIn docClass">Ext.draw.Color</a><br/><a href="../source/Color2.html#Ext-draw.Color-method-fromString" class="viewSource">view source</a></div><a name="fromString"></a><a name="method-fromString"></a><a href="Ext.draw.Color.html#" rel="method-fromString" class="cls expand">fromString</a>(
<span class="pre">String str</span>)
 : void</div><div class="description"><div class="short">Parse the string and create a new color.

Supported formats: '#rrggbb', '#rgb', and 'rgb(r,g,b)'.

If the string is n...</div><div class="long"><p>Parse the string and create a new color.</p>

<p>Supported formats: '#rrggbb', '#rgb', and 'rgb(r,g,b)'.</p>

<p>If the string is not recognized, an undefined will be returned instead.</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">str</span> : String<div class="sub-desc"><p>Color in string.</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;<p>Ext.draw.Color</p>
</li></ul></div></div></div><div id="method-getBlue" class="member ni"><a href="Ext.draw.Color.html#method-getBlue" rel="method-getBlue" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.draw.Color.html" class="definedIn docClass">Ext.draw.Color</a><br/><a href="../source/Color2.html#Ext-draw.Color-method-getBlue" class="viewSource">view source</a></div><a name="getBlue"></a><a name="method-getBlue"></a><a href="Ext.draw.Color.html#" rel="method-getBlue" class="cls expand">getBlue</a> : Number</div><div class="description"><div class="short"><p>Get the blue component of the color, in the range 0..255.</p>
</div><div class="long"><p>Get the blue component of the color, in the range 0..255.</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-getDarker" class="member ni"><a href="Ext.draw.Color.html#method-getDarker" rel="method-getDarker" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.draw.Color.html" class="definedIn docClass">Ext.draw.Color</a><br/><a href="../source/Color2.html#Ext-draw.Color-method-getDarker" class="viewSource">view source</a></div><a name="getDarker"></a><a name="method-getDarker"></a><a href="Ext.draw.Color.html#" rel="method-getDarker" class="cls expand">getDarker</a>(
<span class="pre">Number factor</span>)
 : void</div><div class="description"><div class="short"><p>Return a new color that is darker than this color.</p>
</div><div class="long"><p>Return a new color that is darker than this color.</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">factor</span> : Number<div class="sub-desc"><p>Darker factor (0..1), default to 0.2</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;<p>Ext.draw.Color</p>
</li></ul></div></div></div><div id="method-getGrayscale" class="member ni"><a href="Ext.draw.Color.html#method-getGrayscale" rel="method-getGrayscale" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.draw.Color.html" class="definedIn docClass">Ext.draw.Color</a><br/><a href="../source/Color2.html#Ext-draw.Color-method-getGrayscale" class="viewSource">view source</a></div><a name="getGrayscale"></a><a name="method-getGrayscale"></a><a href="Ext.draw.Color.html#" rel="method-getGrayscale" class="cls expand">getGrayscale</a> : Number</div><div class="description"><div class="short"><p>Returns the gray value (0 to 255) of the color.</p>

<p>The gray value is calculated using the formula r<em>0.3 + g</em>0.59 + b*0.11.</p>
</div><div class="long"><p>Returns the gray value (0 to 255) of the color.</p>

<p>The gray value is calculated using the formula r<em>0.3 + g</em>0.59 + b*0.11.</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-getGreen" class="member ni"><a href="Ext.draw.Color.html#method-getGreen" rel="method-getGreen" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.draw.Color.html" class="definedIn docClass">Ext.draw.Color</a><br/><a href="../source/Color2.html#Ext-draw.Color-method-getGreen" class="viewSource">view source</a></div><a name="getGreen"></a><a name="method-getGreen"></a><a href="Ext.draw.Color.html#" rel="method-getGreen" class="cls expand">getGreen</a> : Number</div><div class="description"><div class="short"><p>Get the green component of the color, in the range 0..255.</p>
</div><div class="long"><p>Get the green component of the color, in the range 0..255.</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-getHSL" class="member ni"><a href="Ext.draw.Color.html#method-getHSL" rel="method-getHSL" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.draw.Color.html" class="definedIn docClass">Ext.draw.Color</a><br/><a href="../source/Color2.html#Ext-draw.Color-method-getHSL" class="viewSource">view source</a></div><a name="getHSL"></a><a name="method-getHSL"></a><a href="Ext.draw.Color.html#" rel="method-getHSL" class="cls expand">getHSL</a> : Array</div><div class="description"><div class="short"><p>Get the equivalent HSL components of the color.</p>
</div><div class="long"><p>Get the equivalent HSL components of the color.</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-getLighter" class="member ni"><a href="Ext.draw.Color.html#method-getLighter" rel="method-getLighter" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.draw.Color.html" class="definedIn docClass">Ext.draw.Color</a><br/><a href="../source/Color2.html#Ext-draw.Color-method-getLighter" class="viewSource">view source</a></div><a name="getLighter"></a><a name="method-getLighter"></a><a href="Ext.draw.Color.html#" rel="method-getLighter" class="cls expand">getLighter</a>(
<span class="pre">Number factor</span>)
 : void</div><div class="description"><div class="short"><p>Return a new color that is lighter than this color.</p>
</div><div class="long"><p>Return a new color that is lighter than this color.</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">factor</span> : Number<div class="sub-desc"><p>Lighter factor (0..1), default to 0.2</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;<p>Ext.draw.Color</p>
</li></ul></div></div></div><div id="method-getRGB" class="member ni"><a href="Ext.draw.Color.html#method-getRGB" rel="method-getRGB" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.draw.Color.html" class="definedIn docClass">Ext.draw.Color</a><br/><a href="../source/Color2.html#Ext-draw.Color-method-getRGB" class="viewSource">view source</a></div><a name="getRGB"></a><a name="method-getRGB"></a><a href="Ext.draw.Color.html#" rel="method-getRGB" class="cls expand">getRGB</a> : Array</div><div class="description"><div class="short"><p>Get the RGB values.</p>
</div><div class="long"><p>Get the RGB values.</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-getRed" class="member ni"><a href="Ext.draw.Color.html#method-getRed" rel="method-getRed" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.draw.Color.html" class="definedIn docClass">Ext.draw.Color</a><br/><a href="../source/Color2.html#Ext-draw.Color-method-getRed" class="viewSource">view source</a></div><a name="getRed"></a><a name="method-getRed"></a><a href="Ext.draw.Color.html#" rel="method-getRed" class="cls expand">getRed</a> : Number</div><div class="description"><div class="short"><p>Get the red component of the color, in the range 0..255.</p>
</div><div class="long"><p>Get the red component of the color, in the range 0..255.</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;
</li></ul></div></div></div><div id="method-toHex" class="member ni"><a href="Ext.draw.Color.html#method-toHex" rel="method-toHex" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.draw.Color.html" class="definedIn docClass">Ext.draw.Color</a><br/><a href="../source/Color2.html#Ext-draw.Color-method-toHex" class="viewSource">view source</a></div><a name="toHex"></a><a name="method-toHex"></a><a href="Ext.draw.Color.html#" rel="method-toHex" class="cls expand">toHex</a>(
<span class="pre">String|Array color</span>)
 : String</div><div class="description"><div class="short"><p>Convert a color to hexadecimal format.</p>
</div><div class="long"><p>Convert a color to hexadecimal format.</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">color</span> : String|Array<div class="sub-desc"><p>The color value (i.e 'rgb(255, 255, 255)', 'color: #ffffff').
Can also be an Array, in this case the function handles the first member.</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The color in hexadecimal format.</p>
</li></ul></div></div></div><div id="method-toString" class="member ni"><a href="Ext.draw.Color.html#method-toString" rel="method-toString" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.draw.Color.html" class="definedIn docClass">Ext.draw.Color</a><br/><a href="../source/Color2.html#Ext-draw.Color-method-toString" class="viewSource">view source</a></div><a name="toString"></a><a name="method-toString"></a><a href="Ext.draw.Color.html#" rel="method-toString" class="cls expand">toString</a> : String</div><div class="description"><div class="short"><p>Return the color in the hex format, i.e. '#rrggbb'.</p>
</div><div class="long"><p>Return the color in the hex format, i.e. '#rrggbb'.</p>
<h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;
</li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>